//
//  NoDataV.swift
//  Employee
//
//  Created by swordjoy on 2017/4/6.
//  Copyright © 2017年 remotevillage. All rights reserved.
//

import UIKit

class NoDataV: UIView {

    var topTipText: String = ""{
        didSet { topTip.text = topTipText }
    }
  
    var bottomTipText: String = ""{
        didSet { bottomTip.text = bottomTipText }
    }
  
    var image: UIImage = UIImage() {
        didSet { bgImageV.image = image }
    }
  
    fileprivate var contentV: UIView!
    fileprivate var topTip: UILabel!
    fileprivate var bottomTip: UILabel!
    fileprivate var bgImageV: UIImageView!

    override init(frame: CGRect) {
    super.init(frame: frame)
        backgroundColor = UIColor.clear
        create()
    }
  
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}

extension NoDataV {

  func create() {
    
    let contentV = UIView()
    addSubview(contentV)
    contentV.backgroundColor = UIColor.white
    contentV.snp.makeConstraints { (make) in
      make.top.left.equalTo(10)
      make.right.equalTo(-10)
      make.bottom.equalTo(-15)
    }
    contentV.layer.cornerRadius = 4
    contentV.layer.masksToBounds = true
    
    topTip = UILabel()
    contentV.addSubview(topTip)
    topTip.font = GlobalConfig.bold20Font
    topTip.textColor = GlobalConfig.BGSkyBlueColor
    topTip.snp.makeConstraints { (make) in
      make.centerX.equalToSuperview()
      make.centerY.equalTo(self.snp.centerY).offset(-25)
    }
    
    bottomTip = UILabel()
    contentV.addSubview(bottomTip)
    bottomTip.font = GlobalConfig.bold20Font
    bottomTip.textColor = GlobalConfig.BGSkyBlueColor
    bottomTip.snp.makeConstraints { (make) in
      make.centerX.equalToSuperview()
      make.centerY.equalTo(self.snp.centerY).offset(25)
    }
    
    bgImageV = UIImageView()
    contentV.addSubview(bgImageV)
    bgImageV.snp.makeConstraints { (make) in
      make.left.equalTo(25)
      make.right.equalTo(-25)
      make.bottom.equalTo(-25)
      make.height.equalTo(200.adaptor)
    }
    
  }
  
}
